﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Spider
{
    public class CrawledData
    {
        public string AboutUrl { get; set; }
        public string ContactUrl { get; set; }
        public string FacebokUrl { get; set; }
        public string PinterestlUrl { get; set; }
        public string OriginalUrl { get; set; }
        public bool DoesIncludePinItButton { get; set; }

        public string ConvertToAbsoulteUrl(string url)
        {
            if (string.IsNullOrEmpty(OriginalUrl) 
                || Uri.IsWellFormedUriString(url, UriKind.Absolute))
                return url;

            var uri = new Uri(OriginalUrl);
            return string.Format("{0}/{1}", uri.GetLeftPart(UriPartial.Authority), url);
        }
    }
}
